/**
 * 内容模块
 */
const express = require('express')
const NewsRouters = express.Router()
const NewsController = require('../controllers/NewsController')
const multer = require('multer')
const upload = multer({ dest: 'public/images/covers'})
/**
 * 新增--字段
 *     title: String, // 标题
 *     author: String, // 创建人
 *     publishdate: String, // 发布时间
 *     cover: String, //封面
 *     content: String, //主题内容
 *     newsid: String, // 用户id
 *     status: Number, // 用户状态（0未发布1已发布）
 */
NewsRouters.post('/news/add',upload.single('file'), NewsController.add)

/**
 * 编辑
 */
NewsRouters.post('/news/edit', upload.single('file'), NewsController.edit)

/**
 * 查询列表
 */
NewsRouters.get('/news/query', NewsController.query)

/***
 * 删除
 * param { id }
 */
NewsRouters.post('/news/deleteOne', NewsController.deleteOne)

/**
 * 查询详情
 */
NewsRouters.get('/news/queryOne', NewsController.queryOne)

module.exports = NewsRouters
